const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_hi_varinst', {
    id: {
      type: DataTypes.STRING(64),
      allowNull: false,
      primaryKey: true,
      field: 'ID_'
    },
    rev: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 1,
      field: 'REV_'
    },
    procInstId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      field: 'PROC_INST_ID_'
    },
    executionId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      field: 'EXECUTION_ID_'
    },
    taskId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      field: 'TASK_ID_'
    },
    name: {
      type: DataTypes.STRING(255),
      allowNull: false,
      field: 'NAME_'
    },
    varType: {
      type: DataTypes.STRING(100),
      allowNull: true,
      field: 'VAR_TYPE_'
    },
    scopeId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'SCOPE_ID_'
    },
    subScopeId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'SUB_SCOPE_ID_'
    },
    scopeType: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'SCOPE_TYPE_'
    },
    bytearrayId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      field: 'BYTEARRAY_ID_'
    },
    double: {
      type: DataTypes.DOUBLE,
      allowNull: true,
      field: 'DOUBLE_'
    },
    long: {
      type: DataTypes.BIGINT,
      allowNull: true,
      field: 'LONG_'
    },
    text: {
      type: DataTypes.STRING(4000),
      allowNull: true,
      field: 'TEXT_'
    },
    text2: {
      type: DataTypes.STRING(4000),
      allowNull: true,
      field: 'TEXT2_'
    },
    createTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'CREATE_TIME_'
    },
    lastUpdatedTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'LAST_UPDATED_TIME_'
    }
  }, {
    sequelize,
    tableName: 'act_hi_varinst',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_" },
        ]
      },
      {
        name: "ACT_IDX_HI_PROCVAR_NAME_TYPE",
        using: "BTREE",
        fields: [
          { name: "NAME_" },
          { name: "VAR_TYPE_" },
        ]
      },
      {
        name: "ACT_IDX_HI_VAR_SCOPE_ID_TYPE",
        using: "BTREE",
        fields: [
          { name: "SCOPE_ID_" },
          { name: "SCOPE_TYPE_" },
        ]
      },
      {
        name: "ACT_IDX_HI_VAR_SUB_ID_TYPE",
        using: "BTREE",
        fields: [
          { name: "SUB_SCOPE_ID_" },
          { name: "SCOPE_TYPE_" },
        ]
      },
      {
        name: "ACT_IDX_HI_PROCVAR_PROC_INST",
        using: "BTREE",
        fields: [
          { name: "PROC_INST_ID_" },
        ]
      },
      {
        name: "ACT_IDX_HI_PROCVAR_TASK_ID",
        using: "BTREE",
        fields: [
          { name: "TASK_ID_" },
        ]
      },
      {
        name: "ACT_IDX_HI_PROCVAR_EXE",
        using: "BTREE",
        fields: [
          { name: "EXECUTION_ID_" },
        ]
      },
    ]
  });
};
